/**
 * Copyright (C) 2010 Cloudfarming <info@cloudfarming.nl>
 *
 * Licensed under the Eclipse Public License - v 1.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.eclipse.org/legal/epl-v10.html
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package nl.cloudfarming.sensor.cropcircle;

/**
 *  enum for defining fields in the crop circle files
 *  contains 'start' 'end' positions, mandatory length, mandatory and dat type
 *  the mandatory lenght is introduced due to the fact that fields could be negative and have a extra minus "-" character
 *  @author Merijn Zengers
 */


public enum CropCircleFileDescription {
	LONGITUDE(1,12,12,true,java.lang.Double.class), //12
	LATITUDE(14,25,12,true,java.lang.Double.class), //12
	FIX_TYPE(27,27,1,true,java.lang.Integer.class), //1
	UTC_TIME(29,37,9,true,java.util.Date.class), //9
	SPEED(39,41,3,true,java.lang.Double.class), //3
	COURSE(43,47,5,true,java.lang.Double.class), //5
	SENSOR(49,49,1,true,java.lang.Double.class), //1
	VI1(51,56,5,true,java.lang.Double.class), //6
	VI2(58,64,6,true,java.lang.Double.class), //7
	R1(66,73,8,true,java.lang.Double.class), //8
	R2(75,82,8,true,java.lang.Double.class), //8
	R3(84,91,8,true,java.lang.Double.class), //8
	APP_RATE(93,93,1,false,java.lang.String.class); //1

	private final int startPosition;
	private final int endPossition;
        private final int mandatoryLength;
	private final boolean mandatroy;
	private final static String delimmiter = ",";
        private final Class theClass;
	
	private CropCircleFileDescription(int startPosition, int endPosition, int mandatoryLength, boolean mandatory, Class theClass ){
		this.startPosition = startPosition;
		this.endPossition = endPosition;
		this.mandatroy = mandatory;
                this.mandatoryLength = mandatoryLength;
                this.theClass = theClass;
	}
	
	public static String getDelimmiter() {
		return delimmiter;
	}

	public int getStartPosition() {
		return startPosition;
	}

	public int getEndPossition() {
		return endPossition;
	}

	public boolean isMandatory() {
		return mandatroy;
	}

        public int getMandatoryLength() {
            return mandatoryLength;
        }

        public Class getTheClass() {
            return theClass;
        }	
}
